<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="#" type="image/png">

    <link rel="icon" href="../../images/hospital-icon.png" type="image/x-icon">  <!--在网页标题左侧显示图标-->
    <!--    <link rel="shortcut icon" href="./images/hospital-icon.png" type="image/x-svg">-->
    <link rel="shortcut icon" href="../../images/hospital-icon.png" type="image/x-icon"><!--在收藏夹显示图标-->

    <title>处方管理-门诊管理系统</title>

    <!--时间风格及输入框风格-->
    <!--pickers css-->
    <link rel="stylesheet" type="text/css" href="../../js/bootstrap-datepicker/css/datepicker-custom.css" />
    <link rel="stylesheet" type="text/css" href="../../js/bootstrap-timepicker/css/timepicker.css" />
    <link rel="stylesheet" type="text/css" href="../../js/bootstrap-colorpicker/css/colorpicker.css" />
    <link rel="stylesheet" type="text/css" href="../../js/bootstrap-daterangepicker/daterangepicker-bs3.css" />
    <link rel="stylesheet" type="text/css" href="../../js/bootstrap-datetimepicker/css/datetimepicker-custom.css" />

    <link href="../../css/style.css" rel="stylesheet">
    <link href="../../css/style-responsive.css" rel="stylesheet">
    <!--时间风格及输入框风格-->

    <!--data table-->
    <link rel="stylesheet" href="../../js/data-tables/DT_bootstrap.css" />

    <link href="../../css/style.css" rel="stylesheet">
    <link href="../../css/style-responsive.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="../../js/html5shiv.js"></script>
    <script src="../../js/respond.min.js"></script>
    <![endif]-->
</head>

<body class="sticky-header">

<section>
    <!-- left side start-->
    <!--左侧开始-->
    <div class="left-side sticky-left-side">

        <!--logo and iconic logo start-->
        <!--侧边栏顶部图标+文字-->
        <div class="logo">
            <a href="index_pharmacy.html">
                <img src="../../images/hospital-icon.png" alt="" style="width: 40px;height: 40px">
                <p style="display: inline-block;font-size: 24px;">门诊管理系统</p>
            </a>
        </div>

        <!--收起状态的侧边栏顶部图标-->
        <div class="logo-icon text-center">
            <a href="index_pharmacy.html"><img src="../../images/hospital-icon.png" alt="" style="width: 40px;height: 40px"></a>
        </div>
        <!--logo and iconic logo end-->

        <div class="left-side-inner">

            <!--sidebar nav start-->
            <!--侧边栏-->
            <ul class="nav nav-pills nav-stacked custom-nav">
                <li class="menu-list nav-active">
                    <a href="">
                        <i class="fa fa-cogs"></i>
                        <span>药库管理</span>
                    </a>
                    <ul class="sub-menu-list">
                        <li><a href="drugInfoList.html"> 药库库存管理</a></li>
                        <li><a href="itemList.html"> 产品管理</a></li>
                        <li><a href="pickingList.html"> 捡药发药管理</a></li>
                        <li class="active"><a href="prescriptionList.html"> 处方管理</a></li>
                    </ul>
                </li>

                <li class="logout">
                    <a href="#">
                        <i class="fa fa-sign-in"></i>
                        <span>退出登录</span>
                    </a>
                </li>

            </ul>
            <!--sidebar nav end-->
            <!--侧边栏导航结束-->

        </div>
    </div>
    <!-- left side end-->
    <!-- 左侧 部分 结束 -->

    <!-- main content start-->
    <div class="main-content" >

        <!-- header section start-->
        <!--顶部菜单部分开始-->
        <div class="header-section">

            <!--toggle button start-->
            <!--拨动按钮-收起侧边栏-->
            <a class="toggle-btn"><i class="fa fa-bars"></i></a>
            <!--toggle button end-->

            <!--notification menu start -->
            <!--通知菜单开始-->
            <div class="menu-right" id="headerApp">
                <ul class="notification-menu">

                    <li>
                        <a href="#" class="btn btn-default  info-number logout">
                            退出登录
                            <i class="fa fa-sign-out"></i>
                        </a>
                    </li>

                </ul>
            </div>
            <!--notification menu end -->
            <!--通知菜单结束-->
        </div>
        <!-- header section end-->
        <!--顶部菜单部分结束-->

        <!--body wrapper start-->
        <div class="wrapper" id="prescriptionApp">
            <div class="row">
                <div class="col-sm-12">
                    <section class="panel">
                        <header class="panel-heading">
                            处方管理
                            <span class="tools pull-right"></span>
                        </header>
                        <div class="panel-body">
                            <div class="adv-table editable-table ">

                                <div class="clearfix"  style="margin-bottom: 20px">
                                    <form class="form-inline" role="form">

                                        <a href="#newPrescription" class="btn btn-info details" data-toggle="modal">
                                            新增
                                            <i class="fa fa-plus"></i>
                                        </a>

                                        <!-- Modal -->
                                        <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="newPrescription" class="modal fade">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header" style="width: auto;height: auto">
                                                        <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                        <h4 class="modal-title">新增处方</h4>
                                                    </div>
                                                    <div class="modal-body"  style="width: auto;height: auto;position: relative">
                                                        <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                            <label class="col-sm-4 control-label">选择电子病历:</label>
                                                            <div class="col-sm-8">
                                                                <input v-model="addPreEMRName" @change="addPreSelectEMRList()" data-toggle="dropdown" type="text" class="form-control dropdown-toggle" style="width: 300px" placeholder="根据患者姓名查询">
                                                                <ul role="menu" class="dropdown-menu" style="position: absolute;right: 15px">
                                                                    <li v-for="emr in addPreEMRList">
                                                                        <a href="#" @click="addCheckThisEMR(emr.emrId,emr.returnAdmissionTime,emr.patientId,emr.patientName)">
                                                                            <span>病历号:</span>
                                                                            <span v-text="emr.emrId">1</span>
                                                                            <span> 患者ID:</span>
                                                                            <span v-text="emr.patientId"> 4</span>
                                                                            <span> 患者名称:</span>
                                                                            <span v-text="emr.patientName"></span>
                                                                            <span> 入院时间</span>
                                                                            <span v-text="emr.returnAdmissionTime"> 曾晨</span>
                                                                        </a>
                                                                    </li>
                                                                </ul>
                                                            </div>
                                                        </div>

                                                        <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                            <label class="col-sm-4 control-label">选择药房:</label>
                                                            <div class="col-sm-8">
                                                                <button data-toggle="dropdown" class="btn btn-info dropdown-toggle" type="button">
                                                                    <span v-text="addPreCheckDepartmentName">选择药房</span>
                                                                    <span class="caret"></span>
                                                                </button>
                                                                <ul role="menu" class="dropdown-menu">
                                                                    <li v-for="PHMdepartment in addDepartmentPHM">
                                                                        <a href="#" @click="addPreCheckThisDepartment(PHMdepartment.id,PHMdepartment.departmentName)">
                                                                            <span v-text="PHMdepartment.departmentName">门诊药房</span>
                                                                        </a>
                                                                    </li>
                                                                </ul>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="modal-footer"  style="width: auto;height: auto;border: none">
                                                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                                        <button type="button" class="btn btn-success" @click="addPrescriptionButton()">保存</button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="btn-group">
                                            <button data-toggle="dropdown" class="btn btn-info dropdown-toggle" type="button">
                                                <span v-text="selectPrePageSizeName">分页数</span>
                                                <span class="caret"></span>
                                            </button>
                                            <ul role="menu" class="dropdown-menu">
                                                <li><a href="#" @click="selectPreCheckThisPageSize(10)">10</a></li>
                                                <li><a href="#" @click="selectPreCheckThisPageSize(20)">20</a></li>
                                                <li><a href="#" @click="selectPreCheckThisPageSize(30)">30</a></li>
                                            </ul>
                                        </div>

                                        <div class="btn-group">
                                            <button data-toggle="dropdown" class="btn btn-info dropdown-toggle" type="button">
                                                <span v-text="selectPreVettingFlagName">审核标记</span>
                                                <span class="caret"></span>
                                            </button>
                                            <ul role="menu" class="dropdown-menu">
                                                <li><a href="#" @click="selectPreCheckThisVetingFlag(1,'通过')">通过</a></li>
                                                <li><a href="#" @click="selectPreCheckThisVetingFlag(0,'未审')">未审</a></li>
                                                <li><a href="#" @click="selectPreCheckThisVetingFlag(2,'重审')">重审</a></li>
                                            </ul>
                                        </div>

                                        <div class="btn-group">
                                            <button data-toggle="dropdown" class="btn btn-info dropdown-toggle" type="button">
                                                <span v-text="selectPrePHMName">选择药房</span>
                                                <span class="caret"></span>
                                            </button>
                                            <ul role="menu" class="dropdown-menu">
                                                <li v-for="PHMdepartment in selectDepartmentPHM">
                                                    <a href="#" @click="selectPreCheckThisDepartment(PHMdepartment.id,PHMdepartment.departmentName)">
                                                        <span v-text="PHMdepartment.departmentName">门诊药房</span>
                                                    </a>
                                                </li>
                                            </ul>
                                        </div>

                                        <div class="form-group">
                                            <input v-model="selectPreForInput" type="text" class="form-control" style="width: 300px" placeholder="根据病历号/患者ID/患者姓名查询">
                                        </div>

                                        <button type="button" class="btn btn-info" @click="selectPreButton()">
                                            查询
                                            <i class="fa fa-search"></i>
                                        </button>
                                        <button type="button" class="btn btn-default" @click="selectPreButtonReset()">
                                            重置
                                            <i class="fa fa-undo"></i>
                                        </button>

                                    </form>
                                </div>


                                <table class="table table-striped table-hover table-bordered" id="editable-sample">
                                    <thead>
                                    <tr>
                                        <th>处方号</th>
                                        <th>患者ID</th>
                                        <th>患者名称</th>
                                        <th>病历号ID</th>
                                        <th>审核标记</th>
                                        <th>审核通过时间</th>
                                        <th>发药药房</th>
                                        <th>创建时间</th>
                                        <th>审方</th>
                                        <th>修改</th>
                                        <th>删除</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr class="" v-for="prescription in prescriptionList">
                                        <td v-text="prescription.prescriptionId">1</td>
                                        <td v-text="prescription.patientId">1</td>
                                        <td v-text="prescription.patientName">曾晨</td>
                                        <td v-text="prescription.emrId">1</td>
                                        <td>
                                            <span class="label label-default" v-if="prescription.vetFlag==0">未审</span>
                                            <span class="label label-info" v-if="prescription.vetFlag==1">通过</span>
                                            <span class="label label-warning" v-if="prescription.vetFlag==2">重审</span>
                                        </td>
                                        <td v-text="prescription.returnVetTransitTime">2022-04-28</td>
                                        <td>
                                            <span class="label label-info" v-text="prescription.returnSendItemPharmacyIdName">门诊药房</span>
                                        </td>
                                        <td v-text="prescription.returnCreateTime">2022-04-28</td>

                                        <td>
                                            <a href="#modifyPrescriptionVetting" class="details" style="color: #46b8da;" data-toggle="modal" @click="modifyVettingSelectPreDetailButton(prescription.prescriptionId)">审方</a>
                                        </td>

                                        <td>
                                            <a href="#modifyPrescriptionModify" class="details" style="color: #46b8da;" data-toggle="modal" @click="modifySelectPreDetail(prescription.prescriptionId)">修改</a>
                                        </td>

                                        <td>
                                            <a :href="'#deleteyPrescription'+prescription.prescriptionId" class="details" style="color: #46b8da;" data-toggle="modal">删除</a>
                                            <!-- Modal -->
                                            <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" :id="'deleteyPrescription'+prescription.prescriptionId" class="modal fade">
                                                <div class="modal-dialog">
                                                    <div class="modal-content">
                                                        <div class="modal-header" style="width: auto;height: auto">
                                                            <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                            <h4 class="modal-title">删除预约</h4>
                                                        </div>
                                                        <div class="modal-body"  style="width: auto;height: auto;position: relative">
                                                            <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                                <label class="col-sm-4 control-label">是否确认删除预约</label>
                                                            </div>
                                                        </div>
                                                        <div class="modal-footer"  style="width: auto;height: auto;border: none">
                                                            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                                            <button type="button" class="btn btn-success" @click="deletePrescriptionButton(prescription.prescriptionId)">保存</button>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>

                                <!--处方修改组件-->
                                <!-- Modal -->
                                <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="modifyPrescriptionModify" class="modal fade">
                                    <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header" style="width: auto;height: auto">
                                                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                <h4 class="modal-title">修改处方信息</h4>
                                            </div>
                                            <div class="modal-body"  style="width: auto;height: auto;position: relative">
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">处方号ID</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="modifyPrescriptionDetail.prescriptionId" class="col-sm-12" type="text" class="form-control" placeholder="请输入处方号ID" disabled>
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">患者ID</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="modifyPrescriptionDetail.patientId" class="col-sm-12" type="text" class="form-control" placeholder="请输入患者ID" disabled>
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">患者姓名</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="modifyPrescriptionDetail.patientName" class="col-sm-12" type="text" class="form-control" placeholder="请输入患者姓名" disabled>
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">病历号ID</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="modifyPrescriptionDetail.emrId" class="col-sm-12" type="text" class="form-control" placeholder="请输入病历号ID" disabled>
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">选择药房:</label>
                                                    <div class="col-sm-8">
                                                        <button data-toggle="dropdown" class="btn btn-info dropdown-toggle" type="button">
                                                            <span v-text="modifyPrescriptionDetail.returnSendItemPharmacyIdName">选择药房 </span>
                                                            <span class="caret"></span>
                                                        </button>
                                                        <ul role="menu" class="dropdown-menu">
                                                            <li v-for="PHMdepartment in modifyDepartmentPHMList">
                                                                <a href="#" @click="modifyPreCheckThisDepartment(PHMdepartment.id,PHMdepartment.departmentName)">
                                                                    <span v-text="PHMdepartment.departmentName">门诊药房</span>
                                                                </a>
                                                            </li>
                                                        </ul>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="modal-footer"  style="width: auto;height: auto;border: none">
                                                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                                <button type="button" class="btn btn-success" @click="modifyPreSaveButton()">保存</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <!--处方审方组件-->
                                <!-- Modal -->
                                <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="modifyPrescriptionVetting" class="modal fade">
                                    <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header" style="width: auto;height: auto">
                                                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                <h4 class="modal-title">处方审方</h4>
                                            </div>
                                            <div class="modal-body"  style="width: auto;height: auto;position: relative">
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">处方号ID</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="vettingPrescriptionDetail.prescriptionId" class="col-sm-12" type="text" class="form-control" placeholder="请输入处方号ID" disabled>
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">患者ID</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="vettingPrescriptionDetail.patientId" class="col-sm-12" type="text" class="form-control" placeholder="请输入患者ID" disabled>
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">患者姓名</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="vettingPrescriptionDetail.patientName" class="col-sm-12" type="text" class="form-control" placeholder="请输入患者姓名" disabled>
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">病历号ID</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="vettingPrescriptionDetail.emrId" class="col-sm-12" type="text" class="form-control" placeholder="请输入病历号ID" disabled>
                                                    </div>
                                                </div>
                                                <div class="btn-group col-sm-12" style="margin-bottom: 15px">
                                                    <label class="col-sm-4 control-label">发药药房</label>
                                                    <div class="col-sm-8">
                                                        <input v-model="vettingPrescriptionDetail.sendItemPharmacyId + vettingPrescriptionDetail.returnSendItemPharmacyIdName" class="col-sm-12" type="text" class="form-control" placeholder="请输入发药药房" disabled>
                                                    </div>
                                                </div>

                                                <div class="col-md-12">
                                                    <div class="panel">
                                                        <div class="panel-body p-states">
                                                            <div class="summary">
                                                                <h4>医嘱列表</h4>
                                                                <div class="panel-body">
                                                                    <table class="table  table-hover general-table">
                                                                        <thead>
                                                                        <tr>
                                                                            <th>医嘱ID</th>
                                                                            <th>处方号</th>
                                                                            <th>产品名称</th>
                                                                            <th>发药量</th>
                                                                            <th>发药单位</th>
                                                                        </tr>
                                                                        </thead>
                                                                        <tbody>
                                                                        <tr v-for="order in modifyVettingOrderList">
                                                                            <td v-text="order.orderId"></td>
                                                                            <td v-text="order.prescriptionId"></td>
                                                                            <td v-text="order.returnItemName"></td>
                                                                            <td v-text="order.sendDose"></td>
                                                                            <td v-text="order.sendDoseUnitName"></td>
                                                                        </tr>
                                                                        </tbody>
                                                                    </table>
                                                                </div>
                                                            </div>
                                                            <div class="chart-bar"></div>
                                                        </div>
                                                    </div>
                                                </div>

                                            </div>
                                            <div class="modal-footer"  style="width: auto;height: auto;border: none">
                                                <button style="margin-left: 50px" type="button" class="btn btn-default"  data-dismiss="modal">
                                                    取消
                                                    <i class="fa fa-reply"></i>
                                                </button>
                                                <button style="margin-left: 50px" type="button" class="btn btn-success" @click="modifyCheckVettingType(vettingPrescriptionDetail.prescriptionId,1)">
                                                    通过
                                                    <i class="fa fa-check-square-o"></i>
                                                </button>
                                                <button style="margin-left: 50px" type="button" class="btn btn-warning" @click="modifyCheckVettingType(vettingPrescriptionDetail.prescriptionId,2)">
                                                    重审
                                                    <i class="fa fa-refresh"></i>
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="clearfix">
                                    <div class="btn-group">

                                    </div>
                                    <div class="btn-group pull-right">
                                        <ul class="pagination pagination-sm">
                                            <li><a href="#"  @click.prevent="loadPreList(pageinfo.prePage)">上一页</a></li>
                                            <li v-for="n in pageinfo.navigatepageNums" @click.prevent="loadPreList(n)" :class="{'active': n == pageinfo.pageNum}">
                                                <a href="#" v-text="n">1</a>
                                            </li>
                                            <li><a href="#" @click.prevent="loadPreList(pageinfo.nextPage)">下一页</a></li>
                                        </ul>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </section>
                </div>
            </div>
        </div>
        <!--body wrapper end-->

        <!--footer section start-->
        <!--页脚部分开始-->
        <footer>
            2022 &copy; <a href="https://gitee.com/allen-zc/OutpatientManagementSystem" target="_blank">基于SSM的门诊管理系统</a>
            -
            <a href="https://gitee.com/allen-zc" target="_blank">AllenChen曾晨</a>
            -
            <p style="display: inline-block">ALL RIGHTS RESERVED.</p>
        </footer>
        <!--footer section end-->
        <!--页脚部分结束-->


    </div>
    <!-- main content end-->
</section>

<!-- Placed js at the end of the document so the pages load faster -->
<script src="../../js/jquery-1.10.2.min.js"></script>
<script src="../../js/jquery-ui-1.9.2.custom.min.js"></script>
<script src="../../js/jquery-migrate-1.2.1.min.js"></script>
<script src="../../js/bootstrap.min.js"></script>
<script src="../../js/modernizr.min.js"></script>
<script src="../../js/jquery.nicescroll.js"></script>

<!--时间风格及输入框风格-->
<!--pickers plugins-->
<script type="text/javascript" src="../../js/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
<script type="text/javascript" src="../../js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="../../js/bootstrap-daterangepicker/moment.min.js"></script>
<script type="text/javascript" src="../../js/bootstrap-daterangepicker/daterangepicker.js"></script>
<script type="text/javascript" src="../../js/bootstrap-colorpicker/js/bootstrap-colorpicker.js"></script>
<script type="text/javascript" src="../../js/bootstrap-timepicker/js/bootstrap-timepicker.js"></script>
<!--pickers initialization-->
<script src="../../js/pickers-init.js"></script>
<!--时间风格及输入框风格-->

<!--data table-->
<script type="text/javascript" src="../../js/data-tables/jquery.dataTables.js"></script>
<script type="text/javascript" src="../../js/data-tables/DT_bootstrap.js"></script>

<!--common scripts for all pages-->
<script src="../../js/scripts.js"></script>

<script src="https://unpkg.zhimg.com/vue"></script>
<!--&lt;!&ndash; 开发环境版本，包含了有帮助的命令行警告 &ndash;&gt;-->
<!--<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>-->
<!--&lt;!&ndash; 生产环境版本，优化了尺寸和速度 &ndash;&gt;-->
<!--<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>-->
<!--axios-->
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>

<!--退出登录的方法-->
<script  type="text/javascript" charset="GB2312"  src="../../userjs/logout.js"></script>
<!--工具箱-->
<script src="../../js/utils.js"></script>

<script>

    let prescriptionApp = new Vue({
        el:'#prescriptionApp',
        data:{
            addPreEMRName:'',
            addPreEMRList:[],
            addPreCheckEMRid:'',
            addDepartmentPHM:[],
            addPreCheckDepartmentId:'',
            addPreCheckDepartmentName:'选择药房',

            selectPrePageSizeName:'分页数',
            selectPrePageSize:'10',
            selectPrePageNum:'1',
            selectPreVettingFlagName:'审核标记',
            selectPreVettingFlag:'',
            selectPreForInput:'', /*查询输入框*/
            selectDepartmentPHM:[],
            selectPrePHMName:'选择药房',
            selectPrePHMId:'',
            prescriptionList:[],
            pageinfo:{},

            vettingPrescriptionDetail:{},
            modifyVettingOrderList:[],

            modifyPrescriptionDetail:{},
            modifyDepartmentPHMList:[],

        },
        methods:{
            // 新增 搜索病历列表
            addPreSelectEMRList:function () {
                let form = new FormData();
                form.append("patientName", this.addPreEMRName)
                axios({
                    url:"/oms/emr/selectEMRList",
                    method:"post",
                    data:form
                }).then(function (res) {
                    prescriptionApp.addPreEMRList = res.data.list
                }).catch(function(error){
                    //失败运行这里,输出错误信息
                    alert(error)
                    console.log(error);
                })
            },
            // 新增 选择病历
            addCheckThisEMR:function (emrId,patientAdmissionId,patientId,patientName) {
                this.addPreCheckEMRid = emrId
                this.addPreEMRName = '病历号:' + emrId + ' 患者ID:' + patientId + ' 患者名称:' + patientName + ' 入院时间:' + patientAdmissionId
            },
            // 新增 查询药房列表
            addPreLoadDepartmentDrug:function () {
                let form=new FormData();
                form.append("pharmacyFlag",'1');
                axios({
                    url:"/oms/department/selectDepartmentList",
                    method:"post",
                    data:form
                }).then(function (res) {
                    prescriptionApp.addDepartmentPHM = res.data.list
                    prescriptionApp.selectDepartmentPHM = res.data.list
                    prescriptionApp.modifyDepartmentPHMList = res.data.list
                }).catch(function(error){
                    //失败运行这里,输出错误信息
                    alert(error)
                    console.log(error);
                })
            },
            // 新增 选择药房
            addPreCheckThisDepartment:function (departmentId,departmentName) {
                this.addPreCheckDepartmentId = departmentId
                this.addPreCheckDepartmentName = departmentName
            },
            // 新增 新增处方按钮
            addPrescriptionButton:function () {
                let form=new FormData();
                form.append("emrId",this.addPreCheckEMRid);
                form.append("sendItemPharmacyId",this.addPreCheckDepartmentId);
                axios({
                    url:"/oms/prescription/addPrescription",
                    method:"post",
                    data:form
                }).then(function (res) {
                   if (res.data=='ok'){
                       alert("新增成功")
                       location.reload();
                   }
                }).catch(function(error){
                    //失败运行这里,输出错误信息
                    alert(error)
                    console.log(error);
                })
            },
            // 查询 选择分页数
            selectPreCheckThisPageSize:function (pageSize) {
                this.selectPrePageSize = pageSize
                this.selectPrePageSizeName = pageSize
            },
            // 查询 选择审核标记
            selectPreCheckThisVetingFlag:function (vettingFlag,vettingFlagName) {
                this.selectPreVettingFlag = vettingFlag
                this.selectPreVettingFlagName = vettingFlagName
            },
            // 查询 查询按钮
            selectPreButton:function () {
                if (this.selectPrePageSize==null||this.selectPrePageSize==''){
                    this.selectPrePageSize=10
                }
                if (this.selectPrePageNum==null||this.selectPrePageNum==''){
                    this.selectPrePageNum=1
                }
                let form=new FormData();
                form.append("selectInput",this.selectPreForInput);
                form.append("vetFlag",this.selectPreVettingFlag);
                form.append("sendItemPharmacyId",this.selectPrePHMId);
                form.append("pageNum",this.selectPrePageNum);
                form.append("pageSize",this.selectPrePageSize);
                axios({
                    url:"/oms/prescription/selectPrescriptionList",
                    method:"post",
                    data:form
                }).then(function (res) {
                    prescriptionApp.prescriptionList = res.data.list
                    prescriptionApp.pageinfo = res.data
                }).catch(function(error){
                    //失败运行这里,输出错误信息
                    alert(error)
                    console.log(error);
                })
            },
            // 查询 选择药房
            selectPreCheckThisDepartment:function (departmentId,departmentName) {
                this.selectPrePHMId = departmentId
                this.selectPrePHMName = departmentName
            },
            //查询 重置
            selectPreButtonReset:function () {
                this.selectPrePageSizeName='分页数'
                this.selectPrePageSize='10'
                this.selectPrePageNum='1'
                this.selectPreVettingFlagName='审核标记'
                this.selectPreVettingFlag=''
                this.selectPreForInput=''
                this.selectDepartmentPHM=[]
                this.selectPrePHMName='选择药房'
                this.selectPrePHMId=''
                this.prescriptionList=[]
                this.pageinfo={}
                this.selectPreButton()
                this.addPreLoadDepartmentDrug()
            },
            // 修改 审方按钮 查询审方详情
            modifyVettingSelectPreDetailButton:function (prescriptionId) {
                //根据处方号查询处方信息
                let form=new FormData();
                form.append("prescriptionId",prescriptionId);
                axios({
                    url:"/oms/prescription/selectPrescriptionDetail",
                    method:"post",
                    data:form
                }).then(function (res) {
                    prescriptionApp.vettingPrescriptionDetail = res.data
                }).catch(function(error){
                    //失败运行这里,输出错误信息
                    alert(error)
                    console.log(error);
                })
                // 执行查询医嘱列表的方法
                this.modifyVettingSelectOrderList(prescriptionId)
            },
            // 审方  查询审方详情 根据处方号查询医嘱
            modifyVettingSelectOrderList:function (prescriptionId) {
                let form=new FormData();
                form.append("prescriptionId",prescriptionId);
                axios({
                    url:"/oms/order/selectOrderList",
                    method:"post",
                    data:form
                }).then(function (res) {
                    prescriptionApp.modifyVettingOrderList = res.data.list
                }).catch(function(error){
                    //失败运行这里,输出错误信息
                    alert(error)
                    console.log(error);
                })
            },
            // 审方 点击 通过/重审 按钮
            modifyCheckVettingType:function (prescriptionId,vettingType) {
                let form=new FormData();
                form.append("prescriptionId",prescriptionId);
                form.append("vetFlag",vettingType);
                axios({
                    url:"/oms/prescription/vetting",
                    method:"post",
                    data:form
                }).then(function (res) {
                    if (res.data=='ok'){
                        alert("审方成功")
                        location.reload()
                    }
                }).catch(function(error){
                    //失败运行这里,输出错误信息
                    alert(error)
                    console.log(error);
                })
            },
            // 修改 查询处方详情
            modifySelectPreDetail:function (prescriptionId) {
                let form=new FormData();
                form.append("prescriptionId",prescriptionId);
                axios({
                    url:"/oms/prescription/selectPrescriptionDetail",
                    method:"post",
                    data:form
                }).then(function (res) {
                    prescriptionApp.modifyPrescriptionDetail = res.data
                }).catch(function(error){
                    //失败运行这里,输出错误信息
                    alert(error)
                    console.log(error);
                })
            },
            // 修改 选择药房
            modifyPreCheckThisDepartment:function (departmentId,departmentName) {
                this.modifyPrescriptionDetail.returnSendItemPharmacyIdName = departmentName
                this.modifyPrescriptionDetail.sendItemPharmacyId = departmentId
            },
            // 修改 保存修改 按钮
            modifyPreSaveButton:function () {
                let form=new FormData();
                form.append("prescriptionId",this.modifyPrescriptionDetail.prescriptionId);
                form.append("sendItemPharmacyId",this.modifyPrescriptionDetail.sendItemPharmacyId);
                axios({
                    url:"/oms/prescription/updatePrescription",
                    method:"post",
                    data:form
                }).then(function (res) {
                    if(res.data=='ok'){
                        alert("修改成功！！！")
                        location.reload()
                    }
                }).catch(function(error){
                    //失败运行这里,输出错误信息
                    alert(error)
                    console.log(error);
                })
            },
            // 上一页 下一页
            loadPreList:function (pageNum) {
                this.selectPrePageNum = pageNum
                this.selectPreButton()
            },
            // 删除处方
            deletePrescriptionButton:function (prescriptionId) {
                axios({
                    url:"/oms/prescription/deletePrescription/" + prescriptionId,
                    method:"get",
                }).then(function (res) {
                    if(res.data=='ok'){
                        alert("删除成功！！！")
                        location.reload()
                    }
                }).catch(function(error){
                    //失败运行这里,输出错误信息
                    alert(error)
                    console.log(error);
                })
            }
        },
        created:function () {
            this.selectPreButton()
            this.addPreLoadDepartmentDrug()
        }
    })

</script>

</body>
</html>
